﻿<navigation:Page x:Class="RIA.Views.Demo" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
		xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit"  				 
		xmlns:my="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
		xmlns:domain="clr-namespace:RIA.Web.Services"
           Title="Demo Page" Style="{StaticResource PageStyle}" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices">
<ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" Margin="20,20">
	<Grid x:Name="LayoutRoot" Width="600">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="1*"/>
			<ColumnDefinition Width="1*"/>
		</Grid.ColumnDefinitions>
		<StackPanel Grid.Column="0">
			<riaControls:DomainDataSource Name="DataSource"
								PageSize="10"
								LoadSize="10"
								AutoLoad="True"
								FilterOperator="And"										  
                                QueryName="GetCustomers">
				<riaControls:DomainDataSource.DomainContext>
					<domain:NorthWindContext/>
				</riaControls:DomainDataSource.DomainContext>
				<riaControls:DomainDataSource.FilterDescriptors>
					<riaControls:FilterDescriptor PropertyPath="CustomerID"
																				Operator="Contains"
																				Value="{Binding Text, ElementName=FilterText}" />
				</riaControls:DomainDataSource.FilterDescriptors>
				<riaControls:DomainDataSource.SortDescriptors>
					<riaControls:SortDescriptor Direction="Ascending"
																		PropertyPath="CustomerID" />
					<riaControls:SortDescriptor Direction="Ascending"
																		PropertyPath="ContactName" />
				</riaControls:DomainDataSource.SortDescriptors>
				<!--<riaControls:DomainDataSource.GroupDescriptors>
				<riaControls:GroupDescriptor PropertyPath="City" />
			</riaControls:DomainDataSource.GroupDescriptors>-->
			</riaControls:DomainDataSource>
			<TextBox x:Name="FilterText" />
			<Button x:Name="SubmitChanges" Content="Submit Changes" Command="{Binding SubmitChangesCommand, ElementName=DataSource}"/>
			<toolkit:DataForm Header="demo"
												ItemsSource="{Binding Data, ElementName=DataSource}"
												CurrentItem="{Binding SelectedItem, ElementName=dataGrid1, Mode=TwoWay}" />

			<sdk:DataGrid Name="dataGrid1" ItemsSource="{Binding ElementName=DataSource, Path=Data}" IsReadOnly="True"/>			
			<my:DataPager Source="{Binding Data, ElementName=DataSource}"
										DisplayMode="FirstLastPreviousNext"
										AutoEllipsis="True"
										IsTotalItemCountFixed="True"
										VerticalAlignment="Bottom" />			
		</StackPanel>

			<StackPanel Grid.Column="1" x:Name="handBind">
				<Button x:Name="hBind" Content="BindText" Click="hBind_Click"/>
				<Button x:Name="SpecialCascadedUpdate" Content="Update In Server" Click="SpecialCascadedUpdate_Click" />
				<TextBox  Text="{Binding Address, Mode=TwoWay}"/>
				<Button Content="Logic Update" Click="Button_Click"/>
			<Button x:Name="Invoke" Content="Invoke" Click="Invoke_Click"/>
			<sdk:DataGrid Name="dataGrid2" />
		</StackPanel>
	</Grid>
	</ScrollViewer>		
</navigation:Page>
